<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>商家提现</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="__INDEX__/store/css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="__INDEX__/store/css/style.css"/>
		<link rel="stylesheet" href="__INDEX__/store/css/iconfont.css" />
		<link rel="stylesheet" href="__INDEX__/store/css/wallet.css" />
	</head>
<style>
	/*.ka_sn{
		position: absolute;top: 0;left: 0; margin-top: -25px;margin-left: 320px;
	}*/
</style>
	<body>
		<header class="mui-bar mui-bar-nav">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" href="JavaScript:history.go(-1)"></a>
		    <h1 class="mui-title">商家提现</h1>
		</header>
		<div class="mui-content">
		    <div class="tixian_pri">
		    	<p>提现金额</p>
		    	<p class="tixian_prinum clearfix">
		    		<label>¥</label>
		    		<input type="text" onkeyup="clearNoNums(this)" id="tixian_money" placeholder="" />
		    	</p>
		    	<p class="tixian_yue" >可提现余额<span id="yue">{$agent_info['balance']}</span>元</p>
		    </div>
		    <div class="pay_paystyle">
		    	<div class="tixian_bankimg"><img src="__INDEX__/store/images/yinlian.gif"></div>
				<div class="tixian_shuom">
					<p>商家营业款提现须知：</p>
					<p>商家签约绑定结算银行卡后，T+1进行结算，结算费率为0；申请成功后，该笔提现会在第二个工作日24:00点之前到账。</p>
				</div>
			</div>
			<button class="wallet_btn" onclick="submit_tx()" style="width: 100%;color: #fff;">确认</button>
		</div>
		
	</body>

</html>
<script type="text/javascript" src="__INDEX__/store/js/mui.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/jquery.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/layer/layer.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/castapp.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__INDEX__/store/js/date.js"></script>
<script>
function clearNoNums(obj)
	{
	   	obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符
	   	obj.value = obj.value.replace(/^\./g,"");  //验证第一个字符是数字而不是.
	   	obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的.
	   	obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
	}
function submit_tx(){
	   $('.wallet_btn').attr("disabled",true);
		var tixian_money =$("#tixian_money").val();
		var yue=$("#yue").text();
		if(tixian_money ==""){
			layer.msg("请输入提现金额");
			return false;
		}
		if(parseFloat(tixian_money) > parseFloat(yue)){
			layer.msg("余额不足");
			return false;
		}
		if(parseFloat(tixian_money)<10){
			layer.msg("提现金额不能小于10元");
			return false;
		}
		
		var obj = $('input:radio[name="type"]:checked').val();
		$.ajax({
				type:'post',
				url:"{:url('agent/yue_tixian')}" ,
				data: {
					tixian_money	: tixian_money
				},
				success: function(data) {
					if(data.code == 200) {
						layer.msg(data.msg, {
						  time: 2000 
						}, function(){
							//location.href="tixian_record.html";
						});
						
					}else{
						layer.msg(data.msg);
						console.log(data.msg);
					}
				}
			})
				
}
</script>
